home *** CD-ROM | disk | FTP | other *** search
- ' Windows Script Host Sample Script
- '
- ' ------------------------------------------------------------------------
- ' Copyright (C) 1996 Microsoft Corporation
- '
- ' You have a royalty-free right to use, modify, reproduce and distribute
- ' the Sample Application Files (and/or any modified version) in any way
- ' you find useful, provided that you agree that Microsoft has no warranty,
- ' obligations or liability for any Sample Application Files.
- ' ------------------------------------------------------------------------
- '
- 'This is a VB Script that adds an OU to the specified directory path
-
-
- dim o
- dim con
- dim oArgs
- dim newou
- dim newuser
- dim Style
- dim Title
- dim CRLF
-
- CRLF = Chr(13) & Chr(10)
-
- set oArgs = WScript.Arguments
-
- If oArgs.Count < 2 Then
- Style = vbOKOnly ' Define buttons.
- Title = "Usage" ' Define title.
-
- Response = MsgBox("Adds an organization unit via OLE DS" & CRLF & CRLF & _
- "Usage:" & CRLF & CRLF & _
- " makeou.vbs location ou " & CRLF & CRLF & _
- "location = DS path" & CRLF & _
- "ou = Organizational unit you want to add." & CRLF, _
- Style, Title)
-
- 'stop script
- WScript.Quit(1)
- End If
-
- set con = WScript.GetObject("LDAP:/"+oArgs.Item(0))
- 'WScript.Echo oArgs.Item(0)
- 'WScript.Echo con.name
- 'WScript.Echo con.oledspath
-
- 'Make a new ou
- 'WScript.Echo oArgs.Item(1)
-
- set newou = con.create("organizationalUnit","OU="+oArgs.Item(1))
- 'WScript.Echo newou.oledspath
-
- newou.put "cn",oArgs.item(1)
- newou.put "description","created from VBS!"
- newou.setinfo
-
- ' Done
- WScript.Echo newou.name+" created."